export default {
	data (){
		return {
			moduleName: 'auth',
			passwordVisible: false,
			timer: 0,
			submitSuccessTipVisible: false,
		}
	},

	computed: {
		computedSendCodeBtnText ({timer}){
			if(timer > 0) return `重新获取(${timer}s)`;

			return '获取验证码';
		}
	},

	methods: {
		startTimer (){
			if(this.timerId) clearTimeout(this.timerId);

			this.timer = 59;

			this.timerId = setInterval(() => {
				this.timer--;

				if(this.timer === 0) this.stopTimer();
			}, 1000);
		},

		stopTimer (){
			this.timer = 0;

			this.timerId && clearInterval(this.timerId);
		},
	}
}
